<template>
<div>
  <header class="navbar navbar-static-top bs-docs-nav">
    <div class="container">
      <div class="navbar-header">
        <a class="navbar-brand" href="#">Brand</a>
      </div>
      <nav class="collapse navbar-collapse">
        <form class="navbar-form navbar-left"> 
          <validator name="form">
            <div class="form-group">
              <input type="text" class="form-control" v-model="ipaddr" v-validate:ipaddr="{ip: true}">
            </div>      
            <button class="btn btn-default" @click.prevent="onRefresh">
              <span class="glyphicon glyphicon-refresh"></span> {{$t("common.refresh")}}
            </button> 
          </validator>                          
        </form>      
      </nav>
    </div>
  </header>
  <div class="container bs-docs-container">
    <div class="row">
      <div class="col-md-9">
        <div class="bs-docs-section">
          <vs-panel></vs-panel>      
        </div>
      </div>
      <div class="col-md-3">
        <vs-affix>
          <nav class="bs-docs-sidebar hidden-print hidden-xs hidden-sm">
            <ul class="nav bs-docs-sidenav">
              <li><a href="#getting-started">Getting started</a></li>
              <li><a href="#getting-started">Getting started</a></li>
              <li><a href="#getting-started">Getting started</a></li>
            </ul>
          </nav>          
        </vs-affix>
      </div>
    </div>
  </div>  
</div>
</template>

<script>
import _ from 'lodash'
import ebus from 'libs/ebus.js'
import toast from 'libs/toast.js'
import {http, setHostname} from 'share/codec/api.js'
import store from 'share/codec/vuex/store.js'
import * as actions from 'share/codec/vuex/actions.js'

export default {
  components: {
  },
  store,
  vuex: {
    actions
  },
  data () {
    return {
      ipaddr: '192.168.1.231',
    }
  },
  methods: {
    onRefresh () {
      if (this.$form.invalid) {
        toast.e(this, this.$t('common.fail'), this.$t('error.invalidAddr'))
        return
      }

      setHostname(this.ipaddr)
      this.getPlatformInfo()
      this.getMultimediaCfg()
    }
  },
  ready () {
  }
}
</script>

<style>
</style>